'use strict';

import React, {Component, PropTypes} from 'react';
import {Icon} from 'amazeui-react';

const bgStyle = {
	width: '100%',
	height: '100%',
	backgroundColor: '#ffffff',
	position: 'fixed',
	top: 0,
	left: 0,
	zIndex: 1111,
	display: 'none',
	opacity: 1,
	borderRadius: 15
};
const headerStyle = {
	width: '100%',
	height: 43,
	lineHeight: '43px',
	borderBottom: '3px solid #0e90d2',
	padding: '0 30px'
};
const iconStyle = {
	cursor: 'pointer'
};
const bodyStyle = {
	padding: 15
};

export default class Modal extends Component {
	/*
	 * 构造函数。
	 * @param props 属性
	 */
	constructor(props) {
		super(props);
		this.state = {};
	}

	/*
	 * 显示。
	 */
	show() {
		this.refs.modal.style.display = 'inline';
	}

	/*
	 * 隐藏。
	 */
	hide() {
		this.refs.modal.style.display = 'none';
	}

	/*
	 * 渲染。
	 */
	render() {
		return (
			<div 
				style={bgStyle}
				ref="modal"
			>
				<header style={headerStyle}>
					<Icon
						icon="arrow-left"
						onClick={this.hide.bind(this)}
						style={iconStyle}
						size="lg"
					/>
				</header>
				<div style={bodyStyle}>{this.props.children}</div>
			</div>
		);
	}
}

Modal.propTypes = {};
Modal.defaultProps = {};
